import requests
import json

# Load the token from the file
def load_token():
    with open("token.txt", "r") as file:
        return file.read().strip()

# API endpoint
url = "http://localhost:8080/api/activation/activate"

# Prepare the data for the API request
data = {
    "license_key": "JX2WH4-WKIL5W-COSV61",  # Replace with the actual license key
    "product_sdk_key": "5d69f1048960a3b009febdc472ddb9a6",  # Replace with the actual product SDK key
    "machine": "XXXXXXXXXXXXXXXX"  # Replace with the actual machine ID
}

# Headers including the token
headers = {
    "Authorization": f"Bearer {load_token()}",
    "Content-Type": "application/json"
}

# Make the POST request to the API
response = requests.post(url, params=data, headers=headers)

# Check if the request was successful
if response.status_code == 200:
    result = response.json()
    print("Activation Successful:", result)
else:
    print("Error:", response.status_code, response.text)